package com.zmn.plat.admin.controller.online.service.group.city;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.plat.model.entity.online.service.group.city.OnlineServiceGroupCity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 在线客服分组城市配置
 *
 * @author linfeng
 *
 * @since 2021-03-26 17:21:53
 */
@RestController
@RequestMapping("/online/service/group/city/")
public class OnlineServiceGroupCityModifyController  extends OnlineServiceGroupCityBaseController  {


    @RequestMapping(value = "configCity")
    @ResponseBody
    @RequiresPermissions("/online/service/group/city/detail.action")
    public ResponseDTO configCity(@RequestBody List<OnlineServiceGroupCity> list) {
        if (CollectionUtils.isEmpty(list)) {
            return ResponseDTO.fail("请选择要配置的城市！");
        }

        String operator = getMcStaffRealName();

        try {
            onlineServiceGroupCityBService.configCity(list, operator);
            return ResponseDTO.success(true, "操作成功！");
        } catch (Exception e) {
            logger.error("configCity error", e);
            return ResponseDTO.fail("系统异常");
        }
    }
}
